package com.hrms.common.utils;

import java.util.UUID;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * uuid
 */
public class OrderNumberGenerator {
 
    private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
 
    public static String generateOrderNumber(String order) {
        // 获取当前时间并格式化
        String timestamp = LocalDateTime.now().format(formatter);
        
        // 生成一个UUID
        UUID uuid = UUID.randomUUID();
        
        // 取UUID的后几位作为随机部分
        String randomPart = uuid.toString().substring(19, 23);
        
        // 拼接时间戳和随机部分
        return order + timestamp + randomPart;
    }

}